<?php
$ibizmag_video_cat = get_option('ibizmag_video_cat');

$is_video_category_selected = "true";
		
if($ibizmag_video_cat == "0" || strlen($ibizmag_video_cat) == 0)
	$is_video_category_selected = "false";

if($is_video_category_selected == "true")
{
	$cat = $ibizmag_video_cat;
	query_posts('cat='.$cat);     
	$count = 0; 
}
?>

<div class="container nogradient">
  <div class="container_inside">
    <div class="content_full">
      <h2>Latest Videos</h2>
      
      <?php if($is_video_category_selected == "true") : ?>
      <div class="video_area">
        <?php if (have_posts()) : ?>
        
        <?php while (have_posts()) : the_post(); ?>
		<?php
            $ibizmag_youtube_id = get_post_meta($post->ID, "ibizmag_youtube_id", true);
        ?>
        
        <?php
		if($count == 0)
		{
		?>
        <div class="video_big">
          <object type="application/x-shockwave-flash" style="width:270px; height:219px;" data="http://www.youtube.com/v/<?php echo $ibizmag_youtube_id; ?>&amp;hl=en&amp;fs=1">
          	<param name="movie" value="http://www.youtube.com/v/<?php echo $ibizmag_youtube_id; ?>&amp;hl=en&amp;fs=1" />
          </object>
        </div>
        <div class="video_list"> 
            <ul class="box_links">
		<?php
		}
		else
		{
		?>
              <li> <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li>
		<?php
		}
		?>
        <?php $count++; ?>
    	<?php endwhile; ?>
            </ul>
            <div class="box_read_more"> <a href="<?php echo get_category_link($cat);?> " title="View More Videos">View More Videos</a> </div>
        </div>
        <?php else: ?>
        No video post to display.
      	<?php endif; ?>
        
      </div>
      <?php else: ?>
      	No Video Category Selected. Please select video category via theme admin menu.
      <?php endif; ?> 
      
      
    </div>
  </div>
</div>
